package com.freight.core.service;


import com.freight.core.base.FreightBaseService;
import com.freight.core.common.vo.SearchVo;
import com.freight.core.entity.User;
import com.freight.core.vo.UserStatistics;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;

/**
 * 用户接口
 * @describe x
 */
@CacheConfig(cacheNames = "user")
public interface UserService extends FreightBaseService<User, Long> {

    com.baomidou.mybatisplus.extension.plugins.pagination.Page<User> getUserByCondition(User user,
                                                                                        SearchVo searchVo,com.baomidou.mybatisplus.extension.plugins.pagination.Page<User> page);


    /**
     * 通过用户名获取用户
     * @param username
     * @return
     */
    @Cacheable(key = "#username")
    User findByUsername(String username);

    /**
     * 通过手机获取用户
     * @param mobile
     * @return
     */
    User findByMobile(String mobile);

    /**
     * 通过邮件和状态获取用户
     * @param email
     * @return
     */
    User findByEmail(String email);

    /**
     * 多条件分页获取用户
     * @param user
     * @param searchVo
     * @param pageable
     * @return
     */
    Page<User> findByCondition(User user, SearchVo searchVo, Pageable pageable);

    /**
     * 通过部门id获取
     * @param departmentId
     * @return
     */
    List<User> findByDepartmentId(Long departmentId);

    /**
     * 通过用户名模糊搜索
     * @param username
     * @param status
     * @return
     */
    List<User> findByUsernameLikeAndStatus(String username, Integer status);

    /*** @param username
     * @param ids
     * @return
     */
    List<User> findByIds(Long[] ids);

    /**
     * 更新部门名称
     * @param departmentId
     * @param departmentTitle
     */
    void updateDepartmentTitle(Long departmentId, String departmentTitle);

    /**
     * 获取当前用户统计接口
     * @return
     */
    UserStatistics getCurrentUserStatistics();

    /**
     * 待审核用户接口
     */
    List<User> getPendingUser();

    /**
     * 根据用户id获取签约状态
     * @param userId
     * @return
     */
    String findByUserId(Long userId);

}
